@layout("../../../common/main.html"){
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-lg12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-form">
                        <div class="layui-form-item">
                            <label class="layui-form-label">作者</label>
                            <div class="layui-input-block">
                                <input type="text" id="author" name="author" lay-verify="required" autocomplete="off"
                                       placeholder="代码生成注释的作者" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">模块名称</label>
                            <div class="layui-input-block">
                                <input type="text" id="modularName" name="modularName" lay-verify="required"
                                       autocomplete="off" placeholder="模块名称(具体到包路径 如:com.ins1st.modular.XX.XX)"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">选择表</label>
                            <div class="layui-input-block">
                                <select id="tableName" name="tableName" lay-verify="required">
                                    <option value="">请选择</option>
                                    @for(t in tables){
                                    <option value="${t}">${t}</option>
                                    @}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="add" id="execute">生成代码</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@}
<script>
    layui.use(['form', 'ax'], function () {
        let $ax = layui.ax;
        let form = layui.form;

        form.on("submit(add)", function (data) {
            var ax = new $ax(ctx + "/gen/start", function (result) {
                admin.success(result.message, function () {
                    admin.close();
                });
            });
            ax.postForm(data.field);
            ax.start();
            return false;
        });
    });
</script>